#include "dataStructures/deQueue.h"

int main() {
    int val;
    DEQUEUE* dq1 = createDequeueDQ();
    val = 3;
    pushTopDQ(&val, sizeof(int), dq1);
    val = 4;
    pushBottomDQ(&val, sizeof(int), dq1);
    printf("%d\t%d\n", *(int*)peekTopDQ(dq1, sizeof(int)), *(int*)peekBottomDQ(dq1, sizeof(int)));
    val = 5;
    pushTopDQ(&val, sizeof(int), dq1);
    val = 6;
    pushBottomDQ(&val, sizeof(int), dq1);
    printf("%d\t%d\t%d\n", dq1->len, *(int*)peekTopDQ(dq1, sizeof(int)), *(int*)peekBottomDQ(dq1, sizeof(int)));
    free(popTopDQ(dq1, 1));
    int* obj = (int*)popBottomDQ(dq1, sizeof(int));
    printf("%d\n", *obj);
    free(obj);
    printf("%d\t%d\t%d\n", dq1->len, *(int*)peekTopDQ(dq1, sizeof(int)), *(int*)peekBottomDQ(dq1, sizeof(int)));
    freeDequeueDQ(dq1);

    printf("\n\n\n");

    double num;
    DEQUEUE* dq2 = createDequeueDQ();
    num = 3.3;
    pushTopDQ(&num, sizeof(double), dq2);
    num = 4.4;
    pushBottomDQ(&num, sizeof(double), dq2);
    printf("%f\t%f\n", *(double*)peekTopDQ(dq2, sizeof(double)), *(double*)peekBottomDQ(dq2, sizeof(double)));
    num = 5.5;
    pushTopDQ(&num, sizeof(double), dq2);
    num = 6.6;
    pushBottomDQ(&num, sizeof(double), dq2);
    printf("%d\t%f\t%f\n", dq2->len, *(double*)peekTopDQ(dq2, sizeof(double)), *(double*)peekBottomDQ(dq2, sizeof(double)));
    free(popTopDQ(dq2, 1));
    double* sel = (double*)popBottomDQ(dq2, sizeof(double));
    printf("%f\n", *sel);
    free(sel);
    printf("%d\t%f\t%f\n", dq2->len, *(double*)peekTopDQ(dq2, sizeof(double)), *(double*)peekBottomDQ(dq2, sizeof(double)));
    freeDequeueDQ(dq2);

    printf("\n\n\n");

    char str[20];
    DEQUEUE* dq3 = createDequeueDQ();
    strcpy(str, "3.3.3");
    pushTopDQ(str, strlen(str), dq3);
    strcpy(str, "4.4.4");
    pushBottomDQ(str, strlen(str), dq3);
    printf("%s\t%s\n", (char*)peekTopDQ(dq3, strlen(str)), (char*)peekBottomDQ(dq3, strlen(str)));
    strcpy(str, "5.5.5");
    pushTopDQ(str, strlen(str), dq3);
    strcpy(str, "6.6.6");
    pushBottomDQ(str, strlen(str), dq3);
    printf("%d\t%s\t%s\n", dq3->len, (char*)peekTopDQ(dq3, strlen(str)), (char*)peekBottomDQ(dq3, strlen(str)));
    free(popTopDQ(dq3, 1));
    char* chs = (char*)popBottomDQ(dq3, strlen(str));
    printf("%s\n", chs);
    free(chs);
    printf("%d\t%s\t%s\n", dq3->len, (char*)peekTopDQ(dq3, strlen(str)), (char*)peekBottomDQ(dq3, strlen(str)));
    freeDequeueDQ(dq3);

    return 0;
}
